<?php
/**
 * Created by PhpStorm.
 * User: 87393
 * Date: 2019-03-27
 * Time: 11:44
 */

namespace App\Http\Controllers\Admin\View;


use App\Http\Controllers\Controller;
use App\Http\Repositories\Services\IRole;
use App\Http\Repositories\Services\ISystem;

class SystemController extends Controller
{

    protected $systemService;
    protected $roleService;

    public function __construct(ISystem $systemService,IRole $roleService)
    {
        $this->systemService = $systemService;
        $this->roleService = $roleService;
    }

    public function page(){
        return view('admin.system.index');
    }

    public function store(){
        $role = $this->roleService->map();
        return view('admin.system.create',['role'=>$role]);
    }

    public function edit($id){
        $dao = $this->systemService->byId($id);
        $role = $this->roleService->map();
        return view('admin.system.edit',['dao'=>$dao,'role'=>$role]);
    }

    public function show($id){
        $dao = $this->systemService->byId($id);
        $role = $this->roleService->map();
        return view('admin.system.show',['dao'=>$dao,'role'=>$role]);
    }

}